package test.course {
	import flash.display.Sprite;
	
	import org.kisekiproject.course.Course;
	
	import test.course.pages.Button;
	import test.course.pages.HeaderAndBody;
	import test.course.pages.NavigationButtons;

	/**
	 * Course test.
	 */
	public class CourseTest extends Sprite {

		// Ensure classes are linked.
		private var classes:Array=[
			HeaderAndBody,
			Button,
			NavigationButtons
		];

		/**
		 * Test a course.
		 */
		public function CourseTest() {
			var source:XML=
				<course>
					<group id="pagegroup">
						<test.course.pages.HeaderAndBody id="page1">
							<header>Hello world</header>
							<body>body text...</body>
						</test.course.pages.HeaderAndBody>

						<test.course.pages.HeaderAndBody id="page2">
							<header>Hello again</header>
						</test.course.pages.HeaderAndBody>
					</group>

					<test.course.pages.NavigationButtons id="nav"/>

					<trigger event="next" from="nav">
						<next group="pagegroup"/>
					</trigger>

					<trigger event="prev" from="nav">
						<previous group="pagegroup"/>
					</trigger>

					<init>
						<first group="pagegroup"/>
					</init>
				</course>;

			var course:Course=new Course();
			addChild(course);
			course.run(source);
		}
	}
}